/**
 * Copyright (C), 2018-2020, 飞尔智能有限公司
 * FileName: UserFeignFallBackFactory
 * Author:   杨乐
 */
package com.yangle.feign;

import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * @description:
 * @Author 杨乐
 * @Date 2020/2/4 16:33
 * @Version 1.0
 **/
@Component
public class UserFeignFallBackFactory implements FallbackFactory<UserFeign> {

    @Override
    public UserFeign create(Throwable throwable) {
        return new UserFeign() {
            @Override
            public User getUser(String name) {
                User user=new User();
                user.setName(throwable.getMessage());
                user.setEmail("接口调用失败");
                return user;
            }

            @Override
            public User getUser(Map<String, String> param) {
                return null;
            }

            @Override
            public User addUser(String name, String email) {
                return null;
            }

            @Override
            public User addUser(User user) {
                return null;
            }
        };
    }
}
    
